﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using UncleBobWebService.Models;
using UncleBobWebService.ServiceRequester;
using UncleBobApplicantWebService.ApplicantWebService;


namespace UncleBobApplicantWebService.Controllers
{
    public class ApplicantMainMenuController : Controller
    {
        //----------------------------------------------
        //----------------------------------------------
        private UncleBobApplicantWebService.ApplicantWebService.WebServiceClient mApplicantClient = new UncleBobApplicantWebService.ApplicantWebService.WebServiceClient();


        //**************************************************
        //Display main menu view
        //**************************************************
        public ActionResult MainMenu()
        {
            return View(Session["User"] as RegisterModel);
        }


        //**************************************************
        //Form action handle
        //**************************************************
        public ActionResult FormAction(FormCollection collection)
        {
            if (collection["cmdSearch"] != null)
            {
                //return RedirectToAction("JobsListView", "StaffingExpertMenu");

                //
                // NOTE:
                // -------------------------------------------------------------
                // Everything below is just for testing purposes - will want to
                // get actual questions from the DB.
                //

                MultipleChoiceQuestion q1 = new MultipleChoiceQuestion("Can you lift 50 pounds?");
                q1.AddPossibleAnswer(0, new Answer("Yes", true));
                q1.AddPossibleAnswer(1, new Answer("No", false));

                MultipleChoiceQuestion q2 = new MultipleChoiceQuestion("Are you at least 18 years of age?");
                q2.AddPossibleAnswer(0, new Answer("Yes", true));
                q2.AddPossibleAnswer(1, new Answer("No", false));

                MultipleChoiceQuestion q3 = new MultipleChoiceQuestion("Are you legally able to work in the US?");
                q3.AddPossibleAnswer(0, new Answer("Yes", true));
                q3.AddPossibleAnswer(1, new Answer("No", false));

                MultipleChoiceQuestion q4 = new MultipleChoiceQuestion("Have you ever been convicted of a felony?");
                q4.AddPossibleAnswer(0, new Answer("Yes", false));
                q4.AddPossibleAnswer(1, new Answer("No", true));

                ExtendedQuestion q5 = new ExtendedQuestion("What is your greatest workplace achievement?");
                ExtendedQuestion q6 = new ExtendedQuestion("Please describe your qualifications for this position.");

                ApplicationQuestions questions = new ApplicationQuestions();
                questions.AddQuestion(q1);
                questions.AddQuestion(q2);
                questions.AddQuestion(q3);
                questions.AddQuestion(q4);
                questions.AddQuestion(q5);
                questions.AddQuestion(q6);

                Session.Add("ApplicationQuestions", questions);

                return RedirectToAction("NextQuestion", "ApplicantApply");
            }
            else if (collection["cmdProfile"] != null)
            {
                return RedirectToAction("Index", "Welcome");
            }

            return RedirectToAction("Index", "Welcome");
        }
    }
}
